extends Control
@onready var detail_label = $Detail
@onready var hover_detail_label = $HoverDetail

#道具属性
@export var prop_name:String = "道具" # 名字
@export var self_destruction:bool = false # 是否能自动销毁
#触发时机定义
#1-->整个回合开始， 2-->单次出牌结算时， 3-->单次出牌结算整体结束， 4-->整个回合结束
@export var trigger_timing = 2
var cost = 0
var prop_id = "BaseProp"
@export var self_description:String = "这是一段描述文字~~~~~~~~~~~~~" # 功能介绍


func _init() -> void:
	pass

func _ready() -> void:
	detail_label.text = self_description
	hover_detail_label.text = self_description
			
func propFunction(deck,scoreMapping,selectedCardsDetail):
	showRunDetail()
	var parent = self.get_parent()
	var grandParent = parent.get_parent()
	var timer = grandParent.timer
	timer.start() #启动计时器
	await timer.timeout # 等待
	hideRunDetail()
	pass

func showRunDetail():
	self.modulate = Color(0.6, 1, 0.6)
	self.scale = Vector2(1.1,1.1)
	
func hideRunDetail():
	self.modulate = Color(1, 1, 1)
	self.scale = Vector2(1,1)
	
func _on_mouse_entered() -> void:
	if self.get_parent():
		var parent = self.get_parent()
		if parent.name == "PlayerProps":
			hover_detail_label.visible = true

func _on_mouse_exited() -> void:
	hover_detail_label.visible = false
